home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr37
/
regreq.zip
/
MISCFN.LIB
< prev
next >
Wrap
Text File
|
1995-03-20
|
3KB
|
105 lines
DECLARE FUNCTION DateDiff(DATE Date1, DATE Date2) INTEGER
DECLARE FUNCTION GetCfgLine(INTEGER fhdl) STRING
DECLARE FUNCTION GetLangText() STRING
DECLARE FUNCTION GetLangExt() STRING
;--------------------------------------------------------------------------
FUNCTION DateDiff(DATE Date1, DATE Date2) INTEGER
' Function returns the number of days difference between Date1 and date2
' as an integer
DateDiff=ABS(Date1-Date2)
ENDFUNC
;-------------------------------------------------------------------------
FUNCTION GetCfgLine(INTEGER fhdl) STRING
'Function Reads a line from a file open on channel fhdl and returns
'the string. All blank lines and lines beginning with a semi-colon
'are considered remarks and are ignored. Returns an empty string
' if an error or the EOF are reached
BOOLEAN ErrFlag
STRING CfgRdLine
LET ErrFlag=FALSE
CfgRdLine=""
WHILE (!ErrFlag) DO
FGET fhdl, CfgRdLine
If (FERR(fhdl)) THEN
ErrFlag=True
BREAK
ENDIF
IF ((TRIM(CfgRdLine," ")="")|(LEFT(CfgRdLine,1)=";")) CONTINUE
BREAK
ENDWHILE
IF (ErrFlag=TRUE) LET CfgRdLine=""
GetCfgLine=CfgRdLine
ENDFUNC
;-------------------------------------------------------------------------
FUNCTION GetLangText() STRING
'Function returns the drive, path, name and extension of the
'PCBTEXT file in use by the current caller.
STRING PathToSys,LocOfText,ExtOfText
INTEGER fhl
PathToSys=GETENV("PCBDRIVE")+GETENV("PCBDIR")+"\PCBOARD.SYS"
LocOfText=READLINE(PCBDAT(),27)+"PCBTEXT"
IF (READLINE(PCBDAT(),74)=FALSE) THEN
GetLangText=LocOfText
Goto OutOfFunc
ENDIF
fhl=FNEXT()
FOPEN fhl,PathToSys,O_RD,S_DN
FSEEK fhl, 80, SEEK_SET
FREAD fhl, ExtOfText, 4
FCLOSE fhl
LocOfText=TRIM(LocOfText+ExtOfText," ")
IF (RIGHT(LocOfText,1)=".") LocOfText=TRIM(LocOfText,".")
GetLangText=LocOfText
:OutOfFunc
ENDFUNC
;-------------------------------------------------------------------------
FUNCTION GetLangExt() STRING
'Function returns the Language Extension of the
'PCBTEXT file in use by the current caller.
STRING PathToSys,ExtOfText
INTEGER fhl
PathToSys=GETENV("PCBDRIVE")+GETENV("PCBDIR")+"\PCBOARD.SYS"
IF (READLINE(PCBDAT(),74)=FALSE) THEN
GetLangExt=""
Goto OutOfFunc
ENDIF
fhl=FNEXT()
FOPEN fhl,PathToSys,O_RD,S_DN
FSEEK fhl, 80, SEEK_SET
FREAD fhl, ExtOfText, 4
FCLOSE fhl
ExtOfText=TRIM(ExtOfText," ")
IF (LEFT(ExtOfText,1)=".") ExtOfText=""
GetLangExt=ExtOfText
:OutOfFunc
ENDFUNC
;-------------------------------------------------------------------------